package org.wenhuayuan.hilibrary

import android.app.Application
import com.google.gson.Gson
import org.wenhuayuan.library.log.HiConsolePrinter
import org.wenhuayuan.library.log.HiLogConfig
import org.wenhuayuan.library.log.HiLogConfig.JsonParser
import org.wenhuayuan.library.log.HiLogManager

class MyApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        HiLogManager.init(object: HiLogConfig() {
            override fun injectJsonParser(): JsonParser {
                // 序列化
                return JsonParser { src->
                    Gson().toJson(src)
                }
            }
            override fun getGlobalTag(): String {
                // 全局TAG
                return "Application"
            }

            override fun enable(): Boolean {
                // 是否开启打印日志
                return true
            }
        }, HiConsolePrinter())
    }
}